package controller;

import java.util.ArrayList;

import model.CategoryDAO;
import model.HostDAO;
import model.SliderDAO;
import model.WebDAO;

import com.opensymphony.xwork2.ActionSupport;

import entity.Category;
import entity.Host;
import entity.Slider;
import entity.Web;

public class IndexAction extends ActionSupport {

    /** serialVersionUID. */
    private static final long serialVersionUID = 1L;

    private ArrayList<Web> listWeb;

    private ArrayList<Category> listCategory;

    private ArrayList<Host> listHost;

    private ArrayList<Slider> listSlider;

    /**
     * Load template on index page.
     * @return index.jsp
     * @throws Exception
     */
    public String loadHomePage() throws Exception {

        /** Load Web Product */
        WebDAO webDAO = new WebDAO();
        listWeb = webDAO.getList();

        /** Load Category of Web */
        CategoryDAO categoryDAO = new CategoryDAO();
        listCategory = categoryDAO.getList();

        /** Load Hosting of Web */
        HostDAO hostDAO = new HostDAO();
        listHost = hostDAO.getList();

        /** Load Slider of Web */
        SliderDAO sliderDAO = new SliderDAO();
        listSlider = sliderDAO.getList();

        return "SUCCESS";
    }

    /**
     * Get value of listWeb.
     * @return the listWeb
     */
    public ArrayList<Web> getListWeb() {
        return listWeb;
    }

    /**
     * Set the value for listWeb.
     * @param listWeb the listWeb to set
     */
    public void setListWeb(ArrayList<Web> listWeb) {
        this.listWeb = listWeb;
    }

    /**
     * Get value of listCategory.
     * @return the listCategory
     */
    public ArrayList<Category> getListCategory() {
        return listCategory;
    }

    /**
     * Set the value for listCategory.
     * @param listCategory the listCategory to set
     */
    public void setListCategory(ArrayList<Category> listCategory) {
        this.listCategory = listCategory;
    }

    /**
     * Get value of listHost.
     * @return the listHost
     */
    public ArrayList<Host> getListHost() {
        return listHost;
    }

    /**
     * Set the value for listHost.
     * @param listHost the listHost to set
     */
    public void setListHost(ArrayList<Host> listHost) {
        this.listHost = listHost;
    }

    /**
     * Get value of listSlider.
     * @return the listSlider
     */
    public ArrayList<Slider> getListSlider() {
        return listSlider;
    }

    /**
     * Set the value for listSlider.
     * @param listSlider the listSlider to set
     */
    public void setListSlider(ArrayList<Slider> listSlider) {
        this.listSlider = listSlider;
    }

}
